<template>
	<view class="index">
		<!-- 头部组件 -->
		<view style="background-color: #fff;">
			<NavBar title="新增"></NavBar>
		</view>
		<!-- 列表 -->
		<view class="contentList">
			<view v-for="item,index in contentListData" :key="index" class="contentItem">
				<label class="radio">
					<radio value="" />
				</label>
				<text>设置{{ item.number }}</text>
			</view>
		</view>
		<!-- 底部区域 -->
		<view class="contactPerson">
			<view class="contactPersonItem">
				<view class="leftKey">紧急联系人</view>
				<input type="text" v-model="person" value="" placeholder="(必填)请输入" />
			</view>
			<view class="contactPersonItem">
				<view class="leftKey">联系电话</view>
				<input type="text" v-model="phoneNumber" value="" placeholder="(必填)请输入" />
			</view>
		</view>
	</view>
</template>

<script setup lang="ts">
	import { ref } from 'vue'
	import { onLoad } from '@dcloudio/uni-app';
	import NavBar from '@/components/navBar.vue'

	const contentListData = ref<any[]>([])
	const person = ref<string>('')
	const phoneNumber = ref<string>('15736596258')

	// 在页面的 onLoad 或 onShow 生命周期函数中获取数据  
	onLoad((option : any) => {
		if (option.data) {
			const decodedData = decodeURIComponent(option.data);
			contentListData.value = JSON.parse(decodedData);
		}
	})
</script>

<style lang="scss" scoped>
	.index {
		height: 100vh;
		background-color: #f4f6fa;
		position: relative;
		.contentList{
			height: calc(100vh - 388rpx);
			overflow-y: scroll;
			padding: 24rpx 23rpx 0rpx 25rpx;
			.contentItem{
				width: 702rpx;
				height: 122rpx;
				background: #FFFFFF;
				border-radius: 24rpx;
				margin-bottom: 20rpx;
				padding: 0 24rpx;
				display: flex;
				align-items: center;
				text {
					font-size: 32rpx;
					color: #262626;
					font-weight: 600;
				}
			}
		}

		.contactPerson {
			position: absolute;
			bottom: 0;
			background-color: #fff;
			width: 750rpx;
			height: 300rpx;
			border-radius: 32rpx 32rpx 0rpx 0rpx;
			padding: 24rpx 24rpx 0;

			.contactPersonItem {
				width: 702rpx;
				height: 90rpx;
				background: #F4F6FA;
				border-radius: 24rpx;
				margin-bottom: 24rpx;
				padding: 0 32rpx;
				display: flex;
				align-items: center;

				.leftKey {
					font-size: 28rpx;
					color: #262626;
					font-weight: 600;
					width: 138rpx;
					margin-right: 48rpx;
				}
			}
		}
	}

	:deep(.uni-input-input) {
		font-size: 28rpx;
		color: #262626;
		font-weight: 600;
	}
</style>